package com.lzw.breezeNovel.webApp.mapper.video;

import com.lzw.breezeNovel.model.entity.pojo.video.VideoCollect;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.mapper.video
 * @date 2025/3/19
 * @description
 */
@Mapper
@SuppressWarnings("all")
public interface VideoCollectMapper {

    /**
     * 取消收藏
     * @param type
     * @param videoId
     * @param userId
     */
    @Delete("delete from video_collect where type = #{type} and video_id = #{videoId} and user_id = #{userId}")
    void cancelCollect(Integer type, Long videoId, Long userId);

    /**
     * 添加收藏
     * @param videoCollect
     */
    @Insert("insert into video_collect (user_id, video_id, type,create_time) values (#{userId}, #{videoId}, #{type},now())")
    void insert(VideoCollect videoCollect);

    /**
     * 判断是否收藏
     * @param type
     * @param videoId
     * @param userId
     * @return
     */
    Boolean isCollect(@Param("type") Integer type, @Param("videoId") Long videoId, @Param("userId") Long userId);
}
